<?php echo $this->tag->form(array()); ?>
<div class="center-block text-center">
    <?php if ($reference) { ?>
    <?php if ($reference->type == 1) { ?>
    <?php echo $this->tag->image(array($reference->content, 'class' => 'img-responsive question-img', 'id' => 'question-img')); ?>
    <?php } else { ?>
    <div><?php echo $reference->content; ?></div>
    <?php } ?>
    <?php } ?>
    <?php if ($audio) { ?>
    <button class="btn black" data-url="<?php echo $audio->url; ?>" id="listen"><i class="fa fa-music"></i></button>
    <?php } ?>
    <?php foreach ($questions as $question) { ?>
    <div class="question-number"><?php echo 'Câu ' . $question['testPosition']; ?></div>
    <?php if ($question['question']) { ?>
    <div>Question: <?php echo $question['question']; ?></div>
    <?php } ?>
    <?php if ($question['answerA']) { ?>
    <div><input name="answer[<?php echo $question['testPosition']; ?>]" type="radio" <?php echo (($question['answer'] == 'A') ? 'checked' : ''); ?> if  value="A"/>A: <?php echo $question['answerA']; ?></div>
    <?php } ?>
    <?php if ($question['answerB']) { ?>
    <div><input name="answer[<?php echo $question['testPosition']; ?>]" type="radio" <?php echo (($question['answer'] == 'B') ? 'checked' : ''); ?> value="B"/>B: <?php echo $question['answerB']; ?></div>
    <?php } ?>
    <?php if ($question['answerC']) { ?>
    <div><input name="answer[<?php echo $question['testPosition']; ?>]" type="radio" <?php echo (($question['answer'] == 'C') ? 'checked' : ''); ?> value="C"/>C: <?php echo $question['answerC']; ?></div>
    <?php } ?>
    <?php if ($question['answerD']) { ?>
    <div><input name="answer[<?php echo $question['testPosition']; ?>]" type="radio" <?php echo (($question['answer'] == 'D') ? 'checked' : ''); ?> value="D"/>D: <?php echo $question['answerD']; ?></div>
    <?php } ?>
    <?php } ?>
    <?php if ($minPosition > 1) { ?>
    <button name="submit" value="back" class="btn black"><i class="fa fa-arrow-left"></i></button>
    <?php } ?>
    <?php if ($maxPosition < $totalQuestions) { ?>
    <button name="submit" value="next" class="btn black"><i class="fa fa-arrow-right"></i></button>
    <?php } ?>
</div>
<input type="hidden" name="minPosition" value="<?php echo $minPosition; ?>"/>
<input type="hidden" name="maxPosition" value="<?php echo $maxPosition; ?>"/>
<?php echo $this->tag->endform(); ?>

<?php echo $this->tag->javascriptInclude('js/soundjs/soundjs-0.5.2.min.js'); ?>
<?php echo $this->tag->javascriptInclude('js/exercise.js'); ?>